home *** CD-ROM | disk | FTP | other *** search
/ Practical Web Pages 2004 September / PracticalWebPages-WPG13-09-2004-Coverdisc.iso / pc / Software / Toolkit / Sothink SWF Quicker 1.5 / data1.cab / Public_Files / Effects / ActionScript / Rotate / Swinging.sqe < prev   
Encoding:
Text File  |  2004-06-14  |  2.6 KB  |  80 lines

  1. ========== Description Part Begin ==========
  2. name = "Swinging";
  3. description = "The characters swing like a pendulum.";
  4. version = "1.00";
  5. bin = "Swinging.bin";
  6. ========== Description Part End ==========
  7.  
  8. ========== Parameter Part Begin ==========
  9. $nCharacterCount(EDIT,INT,1,1 10000,"Total Characters ","The total characters using the special effect. The value is defined by the selected characters in the movie, but can not be changed in the property box.");
  10. $nFrameCount(EDIT,INT,3,3 3,"Total Frames","It indicates the total frames of actions. The total frames of the effect is probably more than it.");
  11. $nInterval(EDIT,INT,5,1 10000,"Interval","The time difference between the former character and the latter one beginning to change.");
  12. $nSpeed(EDIT,INT,10,1 10000,"Speed","The moving speed of characters.");
  13. $nDistance(EDIT,INT,50,1 10000,"Radius","The radius of the swing path.");
  14. $nSpace(EDIT,INT,40,1 10000,"Space","The distance between charactes.");
  15. $nCentreX(EDIT,INT,0,-10000 10000,"X","The X value of the center of a circle.");
  16. $nCentreY(EDIT,INT,0,-10000 10000,"Y","The Y value of the center of a circle.");
  17. ========== Parameter Part End ==========
  18.  
  19. ========== Function Part Begin ==========
  20. nCharacterCount = 4;
  21. nFrameCount = 30;
  22. nCentreX = 200;
  23. nCentreY = 200;
  24. nSpeed = 10;
  25. nDistance = 50;
  26. nSpace = 40;
  27.  
  28. bDirection = true;
  29.  
  30.  
  31. nDistanceArray = new Array(nCharacterCount);
  32. nRotateArray = new Array(nCharacterCount);
  33. nCentreXArray = new Array(nCharacterCount);
  34.  
  35. for (i = 1; i <= nCharacterCount; i++)
  36. {
  37.     nDistanceArray[i - 1] = nDistance;
  38.     nCentreXArray[i - 1] = nCentreX + i * nSpace;
  39.     nRotateArray[i - 1] = 0;
  40. }
  41.  
  42. function fun()
  43. {
  44.     if (nRotateArray[nCharacterCount - 1] > 180)
  45.     {
  46.         bDirection = false;
  47.     } // end if
  48.     if (nRotateArray[nCharacterCount - 1] < 0)
  49.     {
  50.         bDirection = true;
  51.     } // end if
  52.     for (i = 1; i <= nCharacterCount; i++)
  53.     {
  54.         this["c" + i]._x = nCentreXArray[i - 1] + nDistanceArray[i - 1] * Math.cos(0.017453 * nRotateArray[i - 1]);
  55.         this["c" + i]._y = nCentreY + nDistanceArray[i - 1] * Math.sin(0.017453 * nRotateArray[i - 1]);
  56.         this["c" + i]._rotation = nRotateArray[i - 1];
  57.         if (bDirection)
  58.         {
  59.             nRotateArray[i - 1] = nRotateArray[i - 1] + nSpeed;
  60.         }
  61.         else
  62.         {
  63.             nRotateArray[i - 1] = nRotateArray[i - 1] - nSpeed;
  64.         }
  65.     }
  66. }
  67.  
  68.  
  69. function again()
  70. {
  71.     gotoAndPlay(2);
  72. }
  73.  
  74. ========== Function Part End ==========
  75.  
  76. ========== Frame Part Begin ==========
  77. $frame(fun,1,-1,"fun");
  78. $frame(fun,2,-1,"fun");
  79. $frame(again,3,-1,"again");
  80. ========== Frame Part End ==========